package org.dromara.yuanshidian.controller;

import cn.hutool.core.date.DateUtil;
import org.dromara.yuanshidian.domain.bo.Ab04Bo;
import org.dromara.yuanshidian.domain.vo.Ab04Vo;
import org.dromara.yuanshidian.interest.InterestCalcLogicUtil;
import org.dromara.yuanshidian.interest.PaymentInfo;
import org.dromara.yuanshidian.service.IAb04Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.*;

@Component
public class TaskPaymanetinfoData {
    @Autowired
    IAb04Service ab04Service;
    //@Scheduled(cron="0 0/1 * * * ?")
    public void paymentinfoData(){
        Map<Integer,Double> reteMap = new HashMap<>();
        Double[] retes = {0.0378,0.0378,0.0226,0.0198,0.0198,0.0198,0.0226,0.0226,0.028,0.0414,0.0226,0.0226,0.0275,0.035,0.0325,0.03,0.0275};
        for(int i = 0;i<retes.length; i++){
            reteMap.put(i + 1998,retes[i]);
        }
        Date calcPeriod = DateUtil.parse("2014-12-01");
        List<PaymentInfo> paymentInfos = new ArrayList<>();
        Ab04Bo ab04 = new Ab04Bo();
        ab04.setGr04("夏立华");
        List<Ab04Vo> list = ab04Service.queryList(ab04);
        for(Ab04Vo ab04Vo :list){
            for (int i =1;i<=12 ;i++){
                //paymentInfos.add(new PaymentInfo(DateUtil.parse(String.valueOf(ab04Vo.getGrmx02())),ab04Vo.getGr20().doubleValue()));
            }
        }
        //InterestCalcLogicUtil.calcInterest(paymentInfos,calcPeriod,reteMap);
        //InterestCalcLogicUtil.getInterestCalcLocal().getResultMap().keySet().forEach(key -> System.out.println(key+":"+InterestCalcLogicUtil.getInterestCalcLocal().getResultMap().get(key)));
    }
}
